package com.css.fxfzfxqh.modules.seismicHazardData.constants;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class TableNameConstants {

    public static final Map<String, String> MAIN_TABLE_MAP = new HashMap<>();
    public static final Map<String, String> VALUE_TABLE_MAP = new HashMap<>();
    public static final Map<String, Integer> ROLE_TABLE_MAP = new HashMap<>();
    static {
        MAIN_TABLE_MAP.put("qh_gj_role","fxqh_ps_hazard_data_country");
        MAIN_TABLE_MAP.put("qh_province_role","fxqh_ps_hazard_data_province");
        MAIN_TABLE_MAP.put("qh_city_role","fxqh_ps_hazard_data_city");
        MAIN_TABLE_MAP.put("ph_county_role","fxqh_ps_hazard_data_county");
    }
    static {
        VALUE_TABLE_MAP.put("qh_gj_role","fxqh_ps_hazard_data_value_country");
        VALUE_TABLE_MAP.put("qh_province_role","fxqh_ps_hazard_data_value_province");
        VALUE_TABLE_MAP.put("qh_city_role","fxqh_ps_hazard_data_value_city");
        VALUE_TABLE_MAP.put("ph_county_role","fxqh_ps_hazard_data_value_county");
    }

    static {
        ROLE_TABLE_MAP.put("qh_gj_role",0);
        ROLE_TABLE_MAP.put("qh_province_role",1);
        ROLE_TABLE_MAP.put("qh_city_role",2);
        ROLE_TABLE_MAP.put("ph_county_role",3);
    }

    public static String getMainConstant(String role) {
        if(StrUtil.isBlankIfStr(role)){
            return null;
        }
        return MAIN_TABLE_MAP.get(role);
    }

    public static String getValueConstant(String role) {
        if(StrUtil.isBlankIfStr(role)){
            return null;
        }
        return VALUE_TABLE_MAP.get(role);
    }

    public static Integer getRoleConstant(String role) {
        if(StrUtil.isBlankIfStr(role)){
            return null;
        }
        return ROLE_TABLE_MAP.get(role);
    }

}
